package com.aboo.design.facade;

/**
 * @author louan
 * @version 1.0
 * 外观模式
 * 隐藏系统的复杂性，并向客户端提供了一个客户端可以访问系统的接口。
 * @date 2024/2/2
 */
public class FacadePattern {

    public static void main(String[] args) {
        FuwutaiFacade fuwutai = new FuwutaiFacade();
        fuwutai.guahao();
        fuwutai.menzhen();
        fuwutai.quyao();
    }
}

interface Service {
    void service();
}

class Guahao implements Service {

    @Override
    public void service() {
        System.out.println("找 Guahao 提供挂号服务");
    }
}

class Menzhen implements Service {

    @Override
    public void service() {
        System.out.println("找 Menzhen 提供门诊服务");
    }
}

class Yaofang implements Service {

    @Override
    public void service() {
        System.out.println("找 Yaofang 提供抓药服务");
    }
}

class FuwutaiFacade {
    private Service guahao;
    private Service menzhen;
    private Service yaofang;

    public FuwutaiFacade() {
        guahao = new Guahao();
        menzhen = new Menzhen();
        yaofang = new Yaofang();
    }

    public void guahao() {
        guahao.service();
    }

    public void menzhen() {
        menzhen.service();
    }

    public void quyao() {
        yaofang.service();
    }
}